package com.sense.lib.webview;

import android.content.Context;
import android.util.AttributeSet;
import android.view.MotionEvent;


/**
 * <br> ClassName:   FlipSenseBridgeWebView
 * <br> Description: 通用配置PSWebView 主要处理滑ViewPage和WebView滑动冲突
 * <br>
 * <br> @author:      lionszhang
 * <br> Date:        2017/10/27 10:02
 */

public class FlipSenseBridgeWebView extends SenseBridgeWebView {

    public FlipSenseBridgeWebView(Context context, AttributeSet attrs) {
        super(context, attrs);
    }

    public FlipSenseBridgeWebView(Context context, AttributeSet attrs, int defStyle) {
        super(context, attrs, defStyle);
    }

    public FlipSenseBridgeWebView(Context context) {
        super(context);
    }


    @Override
    public boolean onTouchEvent(MotionEvent event) {
        if(event.getAction() == MotionEvent.ACTION_DOWN){
            super.requestDisallowInterceptTouchEvent(true);
        }
        return super.onTouchEvent(event);
    }

    @Override
    protected void onOverScrolled(int scrollX, int scrollY, boolean clampedX, boolean clampedY) {
        if(clampedX){
            super.requestDisallowInterceptTouchEvent(false);
        }
        super.onOverScrolled(scrollX, scrollY, clampedX, clampedY);
    }

}
